home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / macros / tip / mathenv.tip < prev    next >
Text File  |  1993-09-15  |  2KB  |  78 lines

  1. % This macro source file is from the four volume series
  2. % "TeX in Practice" by Stephan von Bechtolsheim, published
  3. % 1993 by Springer-Verlag, New York.
  4. % Copyright 1993 Stephan von Bechtolsheim.
  5. % No warranty or liability is assumed.
  6. % This macro may be copied freely if no fees other than
  7. % media cost or shipping charges are charged and as long
  8. % as this copyright and the following source code itself
  9. % is not changed. Please see the series for further information.
  10. %
  11. % Version: 1.0
  12. % Date: May 1, 1993
  13. %
  14. %
  15. % This source code is documented in 13.1.4, p. II-158.
  16. % Original source in file "math1.TEX", starting line 211.
  17. \wlog{L: "mathenv.tip" ["math1.TEX," l. 211, p. II-158]}%
  18. % This file DOES belong to format "texip."
  19. \def\BeginMath{%
  20.     \ifmath
  21.         \ifinner
  22.             \errmessage{\string\BeginMath: already in math
  23.                 mode, \string\BeginMath ignored.}%
  24.         \else
  25.             \errmessage{\string\BeginMath: in display math
  26.                 mode, terminated and math mode started.}%
  27.             $$
  28.             $
  29.         \fi
  30.     \else
  31.         $\relax
  32.     \fi
  33. }
  34. \def\EndMath{%
  35.     \ifmath
  36.         \ifinner
  37.             $%
  38.         \else
  39.             \errmessage{\string\EndMath: you are in display math
  40.                 mode! Should have used \string\EndDisplayMath!}%
  41.             $$
  42.         \fi
  43.     \else
  44.         \errmessage{\string\EndMath: already in math
  45.             mode, \string\EndMath ignored.}%
  46.     \fi
  47. }
  48. \def\BeginDisplayMath{%
  49.     \ifmath
  50.         \ifinner
  51.             \errmessage{\string\BeginDisplayMath: in inline
  52.                 math mode, terminate it, start display math.}%
  53.             $
  54.             $$
  55.         \else
  56.             \errmessage{\string\BeginDisplayMath: already in math
  57.                 mode, \string\BeginDisplayMath ignored.}%
  58.         \fi
  59.     \else
  60.         $$
  61.     \fi
  62. }
  63. \def\EndDisplayMath{%
  64.     \ifmath
  65.         \ifinner
  66.             \errmessage{\string\EndDisplayMath: inline
  67.                 math mode in effect, did you intend to
  68.                 write \string\EndMath?}%
  69.             $%
  70.         \else
  71.             $$
  72.         \fi
  73.     \else
  74.         \errmessage{\string\EndDisplayMath: not in math
  75.             mode, \string\EndDisplayMath ignored.}%
  76.     \fi
  77. }
  78.